﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace _10_线程_断点调试
{
    internal class Program
    {
        static void Main(string[] args)
        {
            for (int i = 1; i <= 3; i++)
            {
                Thread thread = new Thread(DoWork);
                thread.IsBackground = true;
                thread.Name = "线程-" + i.ToString();
                thread.Start();
            }
            Console.ReadKey();
        }

        public static void DoWork()
        {
            for (int i = 0; i <= 10; i++)
            {
                //获取当前线程ID，打印输出
                Console.WriteLine("Thread-{0}:{1}", Thread.CurrentThread.ManagedThreadId, i);
                Thread.Sleep(1000);
            }
        }
    }
}
